package Test1;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import javax.swing.JOptionPane;

public class user {
	public static void main(String[]args)throws IOException{
	
	String Fname; //user first name
	String Lname; //user last name
	String email; //user email address
  
	FileWriter fw= new FileWriter("registration.csv", true);
	PrintWriter outputFile = new PrintWriter(fw);
 
	int  response = JOptionPane.showConfirmDialog(null, 
			"Would you like to enter anoter user?",
			"Confirm",
			JOptionPane.YES_NO_OPTION,
			JOptionPane.QUESTION_MESSAGE);
 
	while(response==0)
	{
		//Get user first name
		Fname=JOptionPane.showInputDialog("Enter user first name");
		//Get user last name
		Lname=JOptionPane.showInputDialog("Enter user last name");
		//Get user age
		String informedAge = JOptionPane.showInputDialog("Enter user age");
		int age = Integer.valueOf(informedAge);
		//Get user email
		email=JOptionPane.showInputDialog("Enter user email address");
 
		outputFile.print(Fname+", ");
		outputFile.print(Lname + ", ");
		outputFile.print(age + ", ");
		outputFile.println(email);
		
		System.out.println(Fname);
		
 
		response = JOptionPane.showConfirmDialog(null, 
				"Would you like to enter anoter user?",
				"Confirm",
				JOptionPane.YES_NO_OPTION,
				JOptionPane.QUESTION_MESSAGE);
	}
 
	outputFile.close();
 
	}
 
}
 

 
 